﻿#include "findpassword.h"
#include "ui_findpassword.h"
#include "mainwindow.h"

#include <QMessageBox>

findpassword::findpassword(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::findpassword)
{
    ui->setupUi(this);
}

findpassword::~findpassword()
{
    delete ui;
}

void findpassword::setUsernametext(const QString &text)
{
    ui->username->setText(text);
}

void findpassword::on_pushButton_confirm_clicked()
{
    QString username = ui->username->text();
    QString userquestion = ui->userquestion->text();

    MainWindow *par = static_cast<MainWindow *>(this->parentWidget());

    if(!par->filecontains("username=" + username))
    {
        QMessageBox::warning(this, "警告", "没有该账号", QMessageBox::Close);
        return;
    }
    if(par->filecontains("question=" + userquestion))
    {

    }


}


void findpassword::on_pushButton_cancel_clicked()
{
    this->close();
}

